package oj;

import java.util.ArrayDeque;
import java.util.Deque;

/**
 * @author 郝文雪
 * @date 2022/9/4 20:28
 * @Description Test
 */

class MyQueue {
    Deque<Integer> s1;
    Deque<Integer> s2;
    public MyQueue() {
        s1=new ArrayDeque<>();
        s2=new ArrayDeque<>();
    }

    public void push(int x) {
        s1.push(x);
    }

    public int pop() {
        if(s2.isEmpty()){
            while(!s1.isEmpty()){
                s2.push(s1.pop());
            }
        }
        return s2.pop();
    }

    public int peek() {
        if(s2.isEmpty()){
            while(!s1.isEmpty()){
                s2.push(s1.pop());
            }
        }
        return s2.peek();
    }

    public boolean empty() {
        return s1.isEmpty() && s2.isEmpty();
    }
}
public class LC232 {
}
